<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<%layout("/WEB-INF/view/common/inc/admin_head.html",{title:'', styles:'bootstrap,font-awesome,animate,style,bootstrap-table,layui-date'}){}%>
</head>

<body>

<div class="wrapper wrapper-content">
	<div class="row">
		<div class="col-sm-12">
			<div class="ibox-content" style="padding:15px 20px 0px 20px;">
				<form id="search-form" role="form" class="form-horizontal">
					<div class="form-group">
						<label class="control-label col-xs-1">柜号:</label>
						<div class="col-xs-3">
							<input type="text" id="pdfPlanNo" name="pdfPlanNo"   class="form-control">
						</div>
						<a class="search-btn btn btn-success" style="margin-bottom: 0px;">查询</a>
					</div>
				</form>
			</div>
			<!-- START 数据表格 -->
			<table id="dealTable"
				   data-toolbar="#toolbar"
				   data-side-pagination="server"
				   data-pagination="true"
				   data-resizable="true"
				   data-side-pagination="server"
				   data-url="/sea/pdf/findByPdfPlanNo.do"
				   data-page-size="15">
			</table>
			<!-- END 数据表格 -->
		</div>
	</div>
</div>
<%layout("/WEB-INF/view/common/inc/admin_js.html",{modules:'jquery,bootstrap,bootstrap-table,bootstrap-table-zh-CN,layer,laydate'}){}%>
<script>
    var $dealTable = $('#dealTable'),selections=[];

	laydate.render({
		elem: '#recordOperateDate',
		type: 'date',
		trigger: 'click', //修改触发方式
		format: 'yyyy-MM-dd'
	});
    $(function(){


        //START 表格配置
        $dealTable.bootstrapTable({
            height: getHeight(),
            columns: [
                {
                    title: '柜号',
                    field: 'pdfPlanNo',
                    align: 'left',
                    valign: 'middle'
                },
				{
					title: '状态',
					field: 'performanceStatus',
					align: 'center',
					valign: 'middle',
					formatter: optFormatter
				}
            ],
            onLoadSuccess : function() {
				//提交表单
				$('.return-btn').on('click',function(){
					var pdfPlanNo = $(this).attr('data-val');
					layer.confirm('确定要回退当前数据？【'+pdfPlanNo+"】", {
						btn: ['确定','取消'],title:'提示'
					}, function(){
						layer.closeAll();
						var index=layer.load();
						$.post('/sea/pdf/returnBack.do',{pdfPlanNo:pdfPlanNo},function(data){
							if( data.ok ){
								$dealTable.bootstrapTable('refresh');
								layer.msg(data.data,{icon:1,time:1500,shade: [0.8, '#393D49']});
								layer.close(index);
							}else{
								layer.msg(data.msg,{icon: 0,time:1500,shade: [0.8, '#393D49']});
								layer.close(index);
							}
						});
					});
				});
            }
        });
        //END 表格配置

        //表格高度自适应
        $(window).resize(function () {
            $dealTable.bootstrapTable('resetView', {
                height: getHeight()
            });
        });
    });


    //表格高度计算
    function getHeight() {
        return $(window).height() - $('.btn-group').outerHeight(true) - $('.breadcrumb').outerHeight(true)-60;
    }

	// 条件查询
	$('.search-btn').on('click',function () {
		$dealTable.bootstrapTable('refresh', { url:'${ctxPath}/sea/pdf/findByPdfPlanNo.do?'+$('#search-form').serialize() });
	});
	function optFormatter(value,row){
		var content='';
		content += '&nbsp;<button class="return-btn btn btn-xs btn-danger" data-val="' + row.pdfPlanNo + '" title="退回"><i class="fa fa-times"></i> 退回</button>';
		return content;
	}

</script>
</body>
</html>
